package com.ccav.controller;

import com.ccav.domain.Student;
import com.ccav.service.IStudentService;
import com.ccav.util.StudentPage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {

    @Autowired
    private IStudentService iStudentService;

    @RequestMapping("/findOne/{id}")
    @ApiOperation(value = "接口的功能介绍",notes = "提示接口使用者注意事项",httpMethod = "GET")
    @ApiImplicitParam(dataType = "string",name = "name",value = "姓名",required = true)
    public void findOne(@PathVariable Long id){
        System.out.println(iStudentService.getById(id));
    }

    @RequestMapping("/findAll")
    public void findAll(@RequestBody StudentPage studentPage){
        System.out.println(iStudentService.findAll(studentPage));
    }

    @RequestMapping("/del/{id}")
    public void del(@PathVariable Long id){
        iStudentService.removeById(id);
    }

    @RequestMapping("/update")
    public void del(@RequestBody Student student){
        iStudentService.updateById(student);
    }
}
